<template>
    <div>
        <template v-for="(item, index) in options">
            <template v-if="values.includes(item.value)">
                <a-tag :key="item.value" :index="index" color="blue">
                    {{ item.label }}
                </a-tag>
            </template>
        </template>
    </div>
</template>

<script>
export default {
    name: 'DictTag',
    props: {
        options: {
            type: Array,
            default: null
        },
        value: [Number, String, Array, Boolean]
    },
    computed: {
        values() {
            if (this.value !== null && typeof this.value !== 'undefined') {
                return Array.isArray(this.value) ? this.value : [this.value];
            } else {
                return [];
            }
        }
    }
};
</script>
<style scoped>
.a-tag + .a-tag {
    margin-left: 10px;
}
</style>
